package com.catmiao.sql;


import org.apache.spark.SparkContext;
import org.apache.spark.api.java.JavaSparkContext;
import org.apache.spark.sql.SparkSession;

public class Spark01_env {

    public static void main(String[] args) {

        // TODO 构建环境对象
        //      Spark在结构数据还场景中对核心功能、环境进行了封装

/*        org.apache.spark.SparkConf conf = new org.apache.spark.SparkConf();
        conf.setMaster("local[*]");
        conf.setAppName("SparkSQL");

        SparkContext sc = new SparkContext(conf);
        JavaSparkContext jsc = new JavaSparkContext(sc);

        final SparkSession sparkSession = new SparkSession(jsc);*/

        // 构建SparkSQL的环境对象时，一般采用构建器模式
        // 构造器模式：构建对象
        SparkSession sparkSession = SparkSession
                .builder()
                .master("local[*]")
                .appName("SparkSQL")
                .getOrCreate();


        sparkSession.close();
    }

}
